#include "Tela.h"


Tela::Tela(int w, int h, int b, Uint32 f)
{
	width = w;
	height = h;
	bpp = b;
	flags = f;
	surface = NULL;
}

Tela::~Tela(void)
{
}

void Tela::initScreen()
{
	surface = SDL_SetVideoMode(width, height, bpp, flags); 
	limpaTela();
}

void Tela::limpaTela()
{
	SDL_FillRect( surface, &surface->clip_rect, SDL_MapRGB( surface->format, 0xFF, 0xFF, 0xFF ) );
}

void Tela::applyCoisaToTela(Coisa * coisa)
{
	SDL_Rect offset; 
	offset.x = coisa->getPosX(); 
	offset.y = coisa->getPosY();
	
    SDL_BlitSurface( coisa->getSurface(), NULL, surface, &offset); 
}

void Tela::update()
{
	SDL_Flip(surface); 
}

int Tela::getHeight()
{
	return height;
}

int Tela::getWidth()
{
	return width;
}
